home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / objc / Object.h < prev    next >
Text File  |  1991-12-20  |  3KB  |  149 lines

  1. /*
  2.     Object.h
  3.     Copyright 1988, 1989 NeXT, Inc.
  4.   
  5.     DEFINED AS:    A common class
  6.     HEADER FILES:    <objc/Object.h>
  7.  
  8. */
  9.  
  10. #ifndef _OBJC_OBJECT_H_
  11. #define _OBJC_OBJECT_H_
  12.  
  13. #import <objc/objc.h>
  14. #import <objc/objc-class.h>
  15. #import <objc/typedstream.h>
  16. #import <objc/zone.h>
  17. @class Protocol;
  18.  
  19. @interface Object
  20. {
  21.     Class isa;    /* A pointer to the instance's class structure */
  22. }
  23.  
  24. /* Initializing classes and instances */
  25.  
  26. + initialize;
  27. - init;
  28.  
  29. /* Creating, copying, and freeing instances */
  30.  
  31. + new;
  32. + free;
  33. - free;
  34. + alloc;
  35. - copy;
  36. + allocFromZone:(NXZone *)zone;
  37. - copyFromZone:(NXZone *)zone;
  38. - (NXZone *)zone;
  39.  
  40. /* Identifying classes */
  41.  
  42. + class;
  43. + superclass;
  44. + (const char *) name;
  45. - class;
  46. - superclass;
  47. - (const char *) name;
  48.  
  49. /* Identifying and comparing instances */
  50.  
  51. - self;
  52. - (unsigned int) hash;
  53. - (BOOL) isEqual:anObject;
  54.  
  55. /* Testing inheritance relationships */
  56.  
  57. - (BOOL) isKindOf: aClassObject;
  58. - (BOOL) isMemberOf: aClassObject;
  59. - (BOOL) isKindOfClassNamed: (const char *)aClassName;
  60. - (BOOL) isMemberOfClassNamed: (const char *)aClassName;
  61.  
  62. /* Testing class functionality */
  63.  
  64. + (BOOL) instancesRespondTo:(SEL)aSelector;
  65. - (BOOL) respondsTo:(SEL)aSelector;
  66.  
  67. /* Testing protocol conformance */
  68.  
  69. - (BOOL) conformsTo: (Protocol *)aProtocolObject;
  70. + (BOOL) conformsTo: (Protocol *)aProtocolObject;
  71.  
  72. /* Obtaining method descriptors from protocols */
  73.  
  74. - (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
  75. + (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
  76.  
  77. /* Obtaining method handles */
  78.  
  79. - (IMP) methodFor:(SEL)aSelector;
  80. + (IMP) instanceMethodFor:(SEL)aSelector;
  81.  
  82. /* Sending messages determined at run time */
  83.  
  84. - perform:(SEL)aSelector;
  85. - perform:(SEL)aSelector with:anObject;
  86. - perform:(SEL)aSelector with:object1 with:object2;
  87.  
  88. /* Posing */
  89.  
  90. + poseAs: aClassObject;
  91.  
  92. /* Enforcing intentions */
  93.  
  94. - subclassResponsibility:(SEL)aSelector;
  95. - notImplemented:(SEL)aSelector;
  96.  
  97. /* Error handling */
  98.  
  99. - doesNotRecognize:(SEL)aSelector;
  100. - error:(const char *)aString, ...;
  101.  
  102. /* Debugging */
  103.  
  104. - (void) printForDebugger:(NXStream *)stream;
  105.  
  106. /* Archiving */
  107.  
  108. - awake;
  109. - write:(NXTypedStream *)stream;
  110. - read:(NXTypedStream *)stream;
  111. + (int) version;
  112. + setVersion: (int) aVersion;
  113.  
  114. /* Forwarding */
  115.  
  116. - forward: (SEL)sel : (marg_list)args;
  117. - performv: (SEL)sel : (marg_list)args;
  118.  
  119. @end
  120.  
  121. /* Abstract Protocol for Archiving */
  122.  
  123. @interface Object (Archiving)
  124.  
  125. - startArchiving: (NXTypedStream *)stream;
  126. - finishUnarchiving;
  127.  
  128. @end
  129.  
  130. /* Abstract Protocol for Dynamic Loading */
  131.  
  132. @interface Object (DynamicLoading)
  133.  
  134. + finishLoading:(struct mach_header *)header;
  135. + startUnloading;
  136.  
  137. @end
  138.  
  139. extern id object_dispose(Object *anObject);
  140. extern id object_copy(Object *anObject, unsigned nBytes);
  141. extern id object_copyFromZone(Object *anObject, unsigned nBytes, NXZone *);
  142. extern id object_realloc(Object *anObject, unsigned nBytes);
  143. extern id object_reallocFromZone(Object *anObject, unsigned nBytes, NXZone *);
  144.  
  145. extern Ivar object_setInstanceVariable(id, const char *name, void *);
  146. extern Ivar object_getInstanceVariable(id, const char *name, void **);
  147.  
  148. #endif /* _OBJC_OBJECT_H_ */
  149.